header
  • prevSection
  • prev
  • nextSection
  • Navigation Arrow
  • SQL
  • Navigation Arrow
  • DML
  • Navigation Arrow
  • Deleting Data

Data Manipulation Language (DML)

Deleting Data from the Database

Let’s look at that first. The syntax for deleting data from the database in MySQL is

DELETE FROMTableName
[WHERE searchCondition]

A simple implementation of the delete statement would be

DELETE FROMstudent_contact;

As you can see from the above, example: this method removes all data present in the table, leaving behind the table and fields.

A slightly more advanced use of the DELETE clause is as follows

DELETE FROMstudents
WHEREstudent-id=101;

The above example removes all data pertaining to the student whose student id is 101.

  • prevSection
  • prev
  • nextSection
  • Navigation Arrow
  • SQL
  • Navigation Arrow
  • DML
  • Navigation Arrow
  • Deleting Data